package com.mijie.homi.admin.dao.reports;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.mijie.core.IBatisDao;
import com.mijie.core.Paging;
import com.mijie.homi.common.domain.reports.Prosecute;

@Repository
public class ProsecuteDao extends IBatisDao {

	public void listProsecute(Paging<Prosecute> paging,Map<String,Object> parameter){
		this.selectPage(paging, "listProsecute", parameter);
	}
	
	public List<Prosecute> getProsecuteById(int[] ids){
		return this.selectList("getProsecuteById",ids);
	}
	
	public int deleteProsecute(int[] id){
		return this.delete("deleteProsecute", id);
	}
	
	public int markHandled(int[] id){
		return this.update("markHandled", id);
	}
	
	public int handleProsecute(String tableName,long id){
		Map<String,Object> parameter = new HashMap<String,Object>();
		parameter.put("tableName", tableName);
		parameter.put("id", id);
		return this.update("handleProsecute", parameter);
	}
	
	public boolean contentExists(String tableName,long targetId){
		Map<String,Object> parameter = new HashMap<String,Object>();
		parameter.put("tableName", tableName);
		parameter.put("id", targetId);
		return this.selectLong("contentExists",parameter)!=null;
	}
}
